home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 9 / CDACTUAL9.iso / share / Dos / VARIOS / pascal / EGAVGA.SWG / 0006_Show info on Targa file.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1996-02-21  |  1.9 KB  |  69 lines

  1. uses crt,dos;
  2. type
  3. pal       = array[0..255,0..2] of byte;
  4. var
  5. tgaheader : array[1..18] of byte;
  6. tgapal    : pal;
  7. tgatype,storage,bpp: byte;
  8. fil       : file;
  9. i         : byte;
  10. xsize,ysize : word;
  11. begin
  12. clrscr;
  13. assign(fil,'inf\vlagold.tga');
  14. reset(fil,1);
  15. seek(fil,2);
  16. blockreaD(fil,tgatype,1);
  17. seek(fil,12);
  18. blockread(fil,xsize,2);
  19. blockread(fil,ysize,2);
  20. seek(fil,16);
  21. blockread(fil,bpp,1);
  22. blockread(fil,storage,1);
  23. writeln;
  24. writeln('═══════════════ TARGA Information ═══════════════');
  25. writeln;
  26. writeln('═══════════════ Misc. Information ═══════════════');
  27. case tgatype of
  28. 3 :writeln('Type           : 8-bit grayscale uncompressed (3)');
  29. 2 :writeln('Type           : 24-bit true color uncompressed (2)');
  30. 1 :writeln('Type           : 8-bit with palette (1)');
  31. else writeln('Type           : Unknown (',tgatype,')');
  32. end;
  33. case storage of
  34. 32 : writeln('Storing method : Top-down');
  35. 0  : writeln('Storing method : Bottom-up');
  36. else writeln('Storing method : unknown (',storage,')');
  37. end;
  38. writeln;
  39. writeln('═══════════════ Color Information ═══════════════');
  40. writeln('BPP    : ',bpp);
  41. writeln('Colors : ',256*(bpp div 8));
  42. writeln;
  43. writeln('═══════════════  Size Information ═══════════════');
  44. writeln('X-Size : ',xsize);
  45. writeln('Y-Size : ',ysize);
  46. readln;
  47. clrscr;
  48. asm
  49. mov ax,$13
  50. int 10h
  51. end;
  52. if tgatype<3 then begin
  53.                   blockread(fil,tgapal,sizeof(tgapal));
  54.                   port[$3c8]:=0;
  55.                   for i:=0 to 255 do begin
  56.                   port[$3c9]:=tgapal[i,2] shr 2;
  57.                   port[$3c9]:=tgapal[i,1] shr 2;
  58.                   port[$3c9]:=tgapal[i,0] shr 2;
  59.                   end;
  60.                   end;
  61. for i:=0 to ysize-1 do
  62. blockread(fil,mem[$A000:320*i],xsize);
  63. sound(200);
  64. delay(20);
  65. nosound;
  66. repeat until keypressed; while keypressed do readkey;
  67. asm mov ax,3; int 10h; end;
  68. close(fil);
  69. end.